package com.lxw.manage_cms.config;

import com.mongodb.client.MongoDatabase;
import com.mongodb.client.gridfs.GridFSBucket;
import com.mongodb.client.gridfs.GridFSBuckets;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.mongodb.MongoDbFactory;
import org.springframework.web.client.RestTemplate;

@Configuration
public class Config {
    @Autowired
    MongoDbFactory mongoDbFactory;
    @Bean
    public GridFSBucket gridFSBucket(){
        MongoDatabase db = mongoDbFactory.getDb();
        return GridFSBuckets.create(db);


    }
    @Bean
    public RestTemplate restTemplate(){
        return  new RestTemplate();
    }
}
